<template>
<div style="background-color: rgb(27, 30, 34);">
<!--  <h1>{{msg}}</h1>  -->
  <!--  便于测试先放行   记得后面去掉感叹号就行-->

  <div v-if="this.$store.state.user.isRegister">
    <div style="width:1300px;margin:0 auto;min-height:1000px">
      <el-row :gutter="20">
      </el-row>
      <el-col :span="4">
        <div>
          <el-radio-group v-model="isCollapse" style="width:200px">
            <el-radio-button :label="false" style="width:50%">展开</el-radio-button>
            <el-radio-button :label="true" style="width:50%">收起</el-radio-button>
          </el-radio-group>
          <el-menu class="el-menu-vertical-demo"
                   :default-active="$route.path"
                   @open="handleOpen"
                   @close="handleClose"
                   :collapse="isCollapse"
                   router
                   background-color="#545c64"
                   text-color="#fff"
                   active-text-color="#ffd04b">
            <el-menu-item index="/Welcome/Gamelist">
              <i class="el-icon-notebook-2"></i>
              <span slot="title">发起列表</span>
            </el-menu-item>
            <el-menu-item index="/ReleaseMain">
              <i class="el-icon-location"></i>
              <span slot="title">发行游戏</span>
            </el-menu-item>

            <el-menu-item index="2">
              <i class="el-icon-menu"></i>
              <span slot="title">导航二</span>
            </el-menu-item>
            <el-menu-item index="3" disabled>
              <i class="el-icon-document"></i>
              <span slot="title">导航三</span>
            </el-menu-item>

          </el-menu>

        </div>
      </el-col>
      <el-col :span="18">


        <router-view></router-view>
      </el-col>
    </div>
  </div>

  <Register v-if="!this.$store.state.user.isRegister"/>
</div>
</template>

<script>
import Register from "../components/Register";
import Gamelist from "../components/Gamelist";
export default {
  name: "Welcome",
  data(){
    return{
      msg: '这里是登录成功后的欢迎页面',
      isCollapse: true,
    }
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
  },
  components:{
    Register,
    Gamelist
  },
  beforeCreate(){
    if (this.$store.state.user.isRegister){//已经成为发行商  进入时显示游戏列表
      this.$router.push('/Welcome/Gamelist');
    }
  },
  mounted () {

  },
}
</script>

<style scoped>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}
.el-row {
  margin-bottom: 20px;

}
:last-child {
   margin-bottom: 0;
 }
.el-col {
  border-radius: 4px;
}
.bg-purple-dark {
  background: #99a9bf;
}
.bg-purple {
  background: #d3dce6;
}
.bg-purple-light {
  background: #e5e9f2;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}

/deep/
.el-radio-button__inner{
  width:100%;
}
</style>
